Sorry for unreliable dataset and confusing columns

In [1]:
import pandas as pd
In [2]:
df = pd.read_csv('Ecommerce Purchases')
In [3]:
df.columns
Out [3]:
Index(['6534.10.5"', 'Mckinney-Gonzalez', '869957209729483', '02/25', '160',
       'Mastercard', 'david75@miller.biz', 'Production assistant, television',
       '211.51.146.20', 'de', '80.53'],
      dtype='object')

1.Display Top 10 Rows of The Dataset

In [4]:
df.head()
Out [4]:
6534.10.5" Mckinney-Gonzalez 869957209729483 02/25 160 Mastercard david75@miller.biz Production assistant, television 211.51.146.20 de 80.53
PSC 3524, Box 9417\nAPO AA 09217-2597 77 oq PM Mozilla/5.0 (X11; Linux x86_64; rv:1.9.5.20) G... Rodriguez Ltd 210029157389946 07/22 956 Voyager amber18@gmail.com Therapist, art 240.0.241.47 es 4.81
Unit 2512 Box 3240\nDPO AE 73264-2823 34 bB AM Opera/9.33.(X11; Linux x86_64; en-US) Presto/2... Schneider and Sons 210023579873538 12/21 336 VISA 13 digit pjuarez@fisher-burns.net Fine artist 122.180.112.221 el 55.30
Unit 2807 Box 1152\nDPO AE 90364-7161 69 GO AM Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6... Price Ltd 3337549391700444 09/21 979 VISA 16 digit johnsonmaria@jackson-hernandez.biz Learning mentor 67.28.45.167 el 89.63
524 Hill Track Apt. 980\nSandrahaven, GA 68830-0916 52 ss AM Mozilla/5.0 (Windows; U; Windows NT 5.2) Apple... Irwin-Frost 6011932554425502 03/26 832 Diners Club / Carte Blanche hoffmanperry@yahoo.com Seismic interpreter 230.103.41.76 de 48.62
461 William Route Apt. 914\nCoxport, MD 74117 27 EA AM Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_7)... Smith Inc 4206301309941629 09/16 136 Maestro stevemyers@hotmail.com Engineer, civil (contracting) 248.147.6.166 ru 61.83

2. Check Last 3 Rows of The Dataset

In [5]:
df.tail(3)
Out [5]:
6534.10.5" Mckinney-Gonzalez 869957209729483 02/25 160 Mastercard david75@miller.biz Production assistant, television 211.51.146.20 de 80.53
Unit 4434 Box 6343\nDPO AE 28026-0283 74 Zh AM Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_7... Anderson Ltd 6011539787356311 05/21 1 VISA 16 digit tyler16@gmail.com Veterinary surgeon 156.210.0.254 el 83.98
0096 English Rest\nRoystad, IA 12457 74 cL PM Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_8;... Cook Inc 180003348082930 11/17 987 American Express elizabethmoore@reid.net Local government officer 55.78.26.143 es 38.84
40674 Barrett Stravenue\nGrimesville, WI 79682 64 Hr AM Mozilla/5.0 (X11; Linux i686; rv:1.9.5.20) Gec... Greene Inc 4139972901927273 02/19 302 JCB 15 digit rachelford@vaughn.com Embryologist, clinical 176.119.198.199 el 67.59

3. Check Datatype of Each Column

In [6]:
df.dtypes
Out [6]:
6534.10.5"                           object
Mckinney-Gonzalez                    object
869957209729483                       int64
02/25                                object
160                                   int64
Mastercard                           object
david75@miller.biz                   object
Production assistant, television     object
211.51.146.20                        object
de                                   object
80.53                               float64
dtype: object

4.Check Null Values In The Dataset

In [8]:
df.isnull().sum()
Out [8]:
6534.10.5"                          0
Mckinney-Gonzalez                   0
869957209729483                     0
02/25                               0
160                                 0
Mastercard                          0
david75@miller.biz                  0
Production assistant, television    0
211.51.146.20                       0
de                                  0
80.53                               0
dtype: int64

6. How Many Rows And Columns Are There In Our Dataset?

In [9]:
df.shape
Out [9]:
(2363, 11)

7. Highest And Lowest Purchase Prices

In [11]:
df['160'].max()
Out [11]:
9989
In [10]:
df['160'].idxmax()
Out [10]:
('88305 Eileen Prairie\nLake Michellechester, NC 56239', '90 KU', 'PM')
In [12]:
df['160'].idxmin()
Out [12]:
('PSC 6610, Box 2871\nAPO AE 39171-6454', '80 Kd', 'AM')
In [13]:
df['160'].min()
Out [13]:
0

8. Average Purchase Price

In [15]:
df['160'].mean()
Out [15]:
942.6517139229793

9 .How many people have French 'fr' as their Language ?

In [17]:
(df['de'] == 'fr').sum()
Out [17]:
224

11. How Many People Have Mastercard As Their Credit Card Provider And Made A Purchase Above 50?

In [20]:
len(df[(df['Mastercard'] == 'Mastercard') & (df['160'] > 50)])
Out [20]:
173